#include "Archive/DirectLoad.hpp"
#include "Archive/File.hpp"
#include <fstream>

namespace Archive{
IFile::ptr DirectLoad(const char* filename)
{
	std::ifstream ifs(filename,std::ios::in | std::ios::binary);
	if(!ifs)
	{
		return IFile::ptr();
	}
	File* pFile = new Archive::File();
	pFile->m_filename = filename;

	ifs.seekg(0,std::ios::end);
	const int size = static_cast<int>(ifs.tellg());
	pFile->m_data.resize( size );

	ifs.seekg(0,std::ios::beg);
	ifs.read(reinterpret_cast<char*>(&pFile->m_data[0]),size);

	return IFile::ptr( pFile );
}
}//Archive
